import time

width = 50

print("开始".center(width // 2, "-") + "\n")
start = time.perf_counter()
for i in range(width + 1):
    a = '=' * i
    b = '_' * (width - i)
    c = i / width
    dur = time.perf_counter() - start
    print("\r{:^4.0%}[{}{}]{:.2f}s".format(c, a, b, dur), end="")
    time.sleep(0.2)
print("\n\n" + "结束".center(width // 2, "-"))
